package com.jjb.common.view.draw;

import com.jjb.common.view.DrawUtil;
import sun.font.FontDesignMetrics;

import java.awt.*;
import java.util.ArrayList;

public class TextAreaDrawCanvas implements GrawCanvas {

    /**
     * 图片颜色
     */
    private final Color color;

    /**
     * 图片字体
     */
    private final Font font;

    /**
     * 写入图片的X坐标
     */
    private final int x;


    /**
     * 写入图片Y坐标
     */
    private final int y;

    private final int width;

    /**
     * 行间距
     */
    private int rowSpacing = 10;

    /**
     * 间距
     */
    private int spacing = 2;

    /**
     * 写入内容
     */
    private String content;




    /**
     *
     * @param x: 绘制的坐标X
     * @param y：绘制的坐标Y
     * @param content: 图像内容
     * @param
     */
    public TextAreaDrawCanvas(int x,
                              int y,
                              int width,
                              String content,
                              Color markContentColor,
                              Font font) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.content = content;
        this.color = markContentColor;
        this.font = font;
    }


    public int getRowSpacing() {
        return rowSpacing;
    }

    public void setRowSpacing(int rowSpacing) {
        this.rowSpacing = rowSpacing;
    }

    public int getSpacing() {
        return spacing;
    }

    public void setSpacing(int spacing) {
        this.spacing = spacing;
    }

    public void draw(Graphics2D g) {
        DrawUtil.drawTextArea(g, this.color, this.font, this.x, this.y, this.width, this.rowSpacing, spacing, this.content);
    }
}
